//
//  NSString+JSON.m
//  MyPods
//
//  Created by yamyee on 2020/12/5.
//

#import "NSString+JSON.h"

@implementation NSString (JSON)
-(id)yy_jsonObjectWithType:(Class)cls{
    id objc = [self yy_jsonObject];
    if (objc != nil && [objc isKindOfClass:cls]) {
        return objc;
    }
    return nil;
}
-(id)yy_jsonObject{
    
    NSData *data = [self dataUsingEncoding:NSUTF8StringEncoding];
    if (data.length == 0) {
        return nil;
    }
    
    id objc = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:nil];
    return objc;
}
@end
